package com.example.springboot.common;

/**
 * 功能
 * 作者：八滴水
 * 日期： 2024/12/22 18:52
 */

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {

    @Override
    protected void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(jwtInterceptor())
        .addPathPatterns("/**")
        .excludePathPatterns("/login").excludePathPatterns("/register");
        super.addInterceptors(registry);
}
    @Bean
    public JwtInterceptor jwtInterceptor(){
        return new JwtInterceptor();
    }
}
